#include "menu2.h"
#include <QPainter>
#include <QPushButton>
#include <QTimer>
#include "mypushbutton.h"
Menu2::Menu2(QWidget *parent) : QMainWindow(parent)
{
    //配置第二个场景
    this->setFixedSize(1200,900);
    //设置图标
    this->setWindowIcon(QIcon(":/images/run0.png"));
    //设置标题
    this->setWindowTitle("喵斯快跑");
    MyPushButton *playBtn = new MyPushButton(":/images/2bk (2).png");
    playBtn->setParent(this);
    playBtn->resize(350,200);
    playBtn->move(this->width()*0.5-playBtn->width()*0.5+10,this->height()*0.5-playBtn->height()*0.5);

    //创建第三个场景
    play = new PlayScene;

    connect(playBtn,&QPushButton::clicked,[=](){
        QTimer::singleShot(500,this,[=](){
            play->setGeometry(this->geometry());
            this->hide();
            play->show();
        });
    });
}

void Menu2::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/images/2bk.png");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);
}
